<?php

namespace services\base;

use common\models\base\Drug;
use common\models\base\DrugConfig;
use common\components\Service;

/**
 * Class DrugConfigService
 * @package services\base
 */
class DrugConfigService extends Service
{
    /**
     * 药品配置列表
     * @return array
     */
    /*public static function getDrugConfigList(): array
    {
        $res = DrugConfig::find()->alias('dc')
            ->select([
                'dc.id', 'dc.drug_id', 'dc.drug_type', 'dc.drug_volume', 'dc.water_type', 'dc.water_volume',
                'd.drug_name', 'd.drug_unit',
            ])
            ->innerJoin(Drug::tableName().' d', 'd.id = dc.drug_id')
            ->where([
                'd.status' => [Drug::STATUS_ENABLE, Drug::STATUS_INVALID]
            ])
            ->orderBy(['d.sort' => SORT_ASC, 'd.id' => SORT_DESC])
            ->asArray()
            ->all();
        $data = [];
        foreach ($res as $row) {
            $data[] = [
                'id' => $row['id'],
                'name' => DrugService::getDrugContent((int)$row['drug_id'], $row['drug_name'], $row['drug_unit'], $row['drug_type'], $row['drug_volume'], $row['water_type'], $row['water_volume']),
                'type' => 2,// 固定死，前端区分用【1治疗项目、2输液药品】
            ];
        }
        return [
            'id' => 0,
            'name' => '输液药品',
            'child' => $data,
        ];
    }*/
}